Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version Packages #5006

Merged
merged 1 commit into from
Feb 16, 2024
Merged

Version Packages #5006

merged 1 commit into from
Feb 16, 2024

Conversation

workers-devprod
Copy link
Contributor

@workers-devprod workers-devprod commented Feb 13, 2024

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

create-cloudflare@2.12.0

Minor Changes

  • #4996 246512c8 Thanks @jculvey! - feature: Add getBindingsProxy support to nuxt template via nitro-cloudflare-dev module.

    The nuxt template now uses the default dev command from create-nuxt instead of using wrangler pages dev on build output in order to improve the developer workflow. nitro-cloudflare-dev is a nitro module that leverages getBindingsProxy and allows bindings to work in nitro commands.

  • #5027 a751489f Thanks @jculvey! - feature: Improve bindings support in Svelte template.

    C3 will now create Svelte projects with a hook that uses getPlatformProxy to proxy bindings in development mode. A wrangler.toml file will also be added where bindings can be added to be used in conjunction with getPlatformProxy.

    Along with this change, projects will use the default vite-based dev command from create-svelte instead of using wrangler pages dev on build output.

    When Typescript is used, the app.d.ts will be updated to add type definitions for cf and ctx to the Platform interface from the @cloudflare/workers-types package. Types for bindings on platform.env can be re-generated with a newly added build-cf-types script.

Patch Changes

  • #5001 efe8b444 Thanks @dependabot! - chore: Bumped create-hono from 0.3.2 to 0.4.0

  • #5011 89482d44 Thanks @dependabot! - chore: Bumped create-qwik from 1.4.4 to 1.4.5

  • #5019 f939ed73 Thanks @dependabot! - chore: Bumped @angular/create from 17.1.3 to 17.2.0

  • #5020 0e74c743 Thanks @dependabot! - chore: Bumped nuxi from 3.10.0 to 3.10.1

  • #5021 ae1ef47c Thanks @dependabot! - chore: Bumped create-astro from 4.7.2 to 4.7.3

  • #5009 1e263694 Thanks @dario-piotrowicz! - chore: update Next.js template

    Update the C3 Next.js template so that it uses the latest @cloudflare/next-on-pages tooling (i.e. setupDevPlatform and getRequestContext)

  • #4996 246512c8 Thanks @jculvey! - feature: Add an empty wrangler.toml file to qwik and nuxt templates.

  • #4999 ce6d4bc4 Thanks @dario-piotrowicz! - fix: make sure not to wrongly ask users if they want to use typescript

    currently if a CLI invoked by C3 asks the user if they want to use
    typescript and the user opted out of it, C3 could actually again offer
    typescript to the user afterwords, make sure that this does not happen

  • #5010 9f787042 Thanks @dario-piotrowicz! - chore: update qwik template to use getPlatformProxy

    update the C3 Qwik template to use the getPlatformProxy utility instead of the deprecated getBindingsProxy one

miniflare@3.20240129.3

Minor Changes

  • #4795 027f9719 Thanks @mrbbot! - feat: pass Miniflare instance as argument to custom service binding handlers

    This change adds a new Miniflare-typed parameter to function-valued service binding handlers. This provides easy access to the correct bindings when re-using service functions across instances.

    import assert from "node:assert";
    import { Miniflare, Response } from "miniflare";
    
    const mf = new Miniflare({
    	serviceBindings: {
    		SERVICE(request, instance) {
    			assert(instance === mf);
    			return new Response();
    		},
    	},
    });
  • #4795 027f9719 Thanks @mrbbot! - feat: allow URLs to be passed in hyperdrives

    Previously, the hyperdrives option only accepted strings as connection strings. This change allows URL objects to be passed too.

  • #4795 027f9719 Thanks @mrbbot! - feat: add support for custom root paths

    Miniflare has lots of file-path-valued options (e.g. scriptPath, kvPersist, textBlobBindings). Previously, these were always resolved relative to the current working directory before being used. This change adds a new rootPath shared, and per-worker option for customising this behaviour. Instead of resolving relative to the current working directory, Miniflare will now resolve path-valued options relative to the closest rootPath option. Paths are still resolved relative to the current working directory if no rootPaths are defined. Worker-level rootPaths are themselves resolved relative to the shared rootPath if defined.

    import { Miniflare } from "miniflare";
    
    const mf1 = new Miniflare({
    	scriptPath: "index.mjs",
    });
    
    const mf2 = new Miniflare({
    	rootPath: "a/b",
    	scriptPath: "c/index.mjs",
    });
    
    const mf3 = new Miniflare({
    	rootPath: "/a/b",
    	workers: [
    		{
    			name: "1",
    			rootPath: "c",
    			scriptPath: "index.mjs",
    		},
    		{
    			name: "2",
    			scriptPath: "index.mjs",
    		},
    	],
    });
  • #4795 027f9719 Thanks @mrbbot! - feat: allow easy binding to current worker

    Previously, if you wanted to create a service binding to the current Worker, you'd need to know the Worker's name. This is usually possible, but can get tricky when dealing with many Workers. This change adds a new kCurrentWorker symbol that can be used instead of a Worker name in serviceBindings. kCurrentWorker always points to the Worker with the binding.

    import { kCurrentWorker, Miniflare } from "miniflare";
    
    const mf = new Miniflare({
    	serviceBindings: {
    		SELF: kCurrentWorker,
    	},
    	modules: true,
    	script: `export default {
        fetch(request, env, ctx) {
          const { pathname } = new URL(request.url);
          if (pathname === "/recurse") {
            return env.SELF.fetch("http://placeholder");
          }
          return new Response("body");
        }
      }`,
    });
    
    const response = await mf.dispatchFetch("http://placeholder/recurse");
    console.log(await response.text()); // body

Patch Changes

  • #4954 7723ac17 Thanks @mrbbot! - fix: allow relative scriptPath/modulesRoots to break out of current working directory

    Previously, Miniflare would resolve relative scriptPaths against moduleRoot multiple times resulting in incorrect paths and module names. This would lead to can't use ".." to break out of starting directory workerd errors. This change ensures Miniflare uses scriptPath as is, and only resolves it relative to modulesRoot when computing module names. Note this bug didn't affect service workers. This allows you to reference a modules scriptPath outside the working directory with something like:

    const mf = new Miniflare({
    	modules: true,
    	modulesRoot: "..",
    	scriptPath: "../worker.mjs",
    });

    Fixes 🐛 BUG: "can't use ".." to break out of starting directory" when using Service Bindings in monorepo #4721

  • #4795 027f9719 Thanks @mrbbot! - fix: return non-WebSocket responses for failed WebSocket upgrading fetch()es

    Previously, Miniflare's fetch() would throw an error if the Upgrade: websocket header was set, and a non-WebSocket response was returned from the origin. This change ensures the non-WebSocket response is returned from fetch() instead, with webSocket set to null. This allows the caller to handle the response as they see fit.

  • #4795 027f9719 Thanks @mrbbot! - fix: ensure MiniflareOptions, WorkerOptions, and SharedOptions types are correct

    Miniflare uses Zod for validating options. Previously, Miniflare inferred *Options from the output types of its Zod schemas, rather than the input types. In most cases, these were the same. However, the hyperdrives option has different input/output types, preventing these from being type checked correctly.

@cloudflare/pages-shared@0.11.13

Patch Changes

wrangler@3.28.3

Patch Changes

  • #5026 04584722 Thanks @dario-piotrowicz! - fix: make sure getPlatformProxy produces a production-like caches object

    make sure that the caches object returned to getPlatformProxy behaves
    in the same manner as the one present in production (where calling unsupported
    methods throws a helpful error message)

    note: make sure that the unsupported methods are however not included in the
    CacheStorage type definition

  • #5030 55ea0721 Thanks @mrbbot! - fix: don't suggest reporting user errors to GitHub

    Wrangler has two different types of errors: internal errors caused by something going wrong, and user errors caused by an invalid configuration. Previously, we would encourage users to submit bug reports for user errors, even though there's nothing we can do to fix them. This change ensures we only suggest this for internal errors.

  • #4900 3389f2e9 Thanks @OilyLime! - feature: allow hyperdrive users to set local connection string as environment variable

    Wrangler dev now supports the HYPERDRIVE_LOCAL_CONNECTION_STRING environmental variable for connecting to a local database instance when testing Hyperdrive in local development. This environmental variable takes precedence over the localConnectionString set in wrangler.toml.

  • #5033 b1ace91b Thanks @mrbbot! - fix: wait for actual port before opening browser with --port=0

    Previously, running wrangler dev --remote --port=0 and then immediately pressing b would open localhost:0 in your default browser. This change queues up opening the browser until Wrangler knows the port the dev server was started on.

  • #5026 04584722 Thanks @dario-piotrowicz! - fix: relax the getPlatformProxy's' cache request/response types

    prior to these changes the caches obtained from getPlatformProxy
    would use unknowns as their types, this proved too restrictive
    and incompatible with the equivalent @cloudflare/workers-types
    types, we decided to use anys instead to allow for more flexibility
    whilst also making the type compatible with workers-types

  • Updated dependencies [7723ac17, 027f9719, 027f9719, 027f9719, 027f9719, 027f9719, 027f9719]:

    • miniflare@3.20240129.3

@cloudflare/vitest-pool-workers@0.0.2

Patch Changes

@workers-devprod workers-devprod requested review from a team as code owners February 13, 2024 18:53
Copy link
Contributor

github-actions bot commented Feb 13, 2024

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7935024366/npm-package-wrangler-5006

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5006/npm-package-wrangler-5006

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7935024366/npm-package-wrangler-5006 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7935024366/npm-package-create-cloudflare-5006 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7935024366/npm-package-cloudflare-kv-asset-handler-5006
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7935024366/npm-package-miniflare-5006
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7935024366/npm-package-cloudflare-pages-shared-5006
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7935024366/npm-package-cloudflare-vitest-pool-workers-5006

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.28.3 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240129.3
workerd 1.20240129.0 1.20240129.0
workerd --version 1.20240129.0 2024-01-29

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b1ace91) 70.33% compared to head (9ed4a58) 70.37%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5006      +/-   ##
==========================================
+ Coverage   70.33%   70.37%   +0.04%     
==========================================
  Files         297      297              
  Lines       15458    15458              
  Branches     3966     3966              
==========================================
+ Hits        10872    10879       +7     
+ Misses       4586     4579       -7     

see 6 files with indirect coverage changes

@lrapoport-cf lrapoport-cf merged commit fd0fb23 into main Feb 16, 2024
27 checks passed
@lrapoport-cf lrapoport-cf deleted the changeset-release/main branch February 16, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

🐛 BUG: "can't use ".." to break out of starting directory" when using Service Bindings in monorepo
3 participants